import App from './App'

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	...App
})
app.$mount()
// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	return {
		app
	}
}
// #endif

/**
 * 存储信息
 */
import stoarge from "@/utils/stoarge.js";
Vue.prototype.$stoarge = stoarge;
/**
 * 吐司
 */
import st from "@/utils/showtoast.js";
Vue.prototype.$st = st;
/**
 * js方法
 */
import filters from "@/utils/filters.js";
Vue.prototype.$filters = filters;
/**
 * 防抖函数
 */
var debounceTimer = null;
Vue.prototype.$debounce = function(func, delay = 1000) {
	if (debounceTimer !== null) {
		clearTimeout(debounceTimer);
	}
	debounceTimer = setTimeout(() => {
		typeof func === "function" && func();
	}, delay);
};
/**
 * 节流函数
 */
var throttleTimer = false;
Vue.prototype.$throttle = function(func, delay = 3000) {
	if (throttleTimer === true) {
		return;
	}
	throttleTimer = true;
	setTimeout(() => {
		throttleTimer = false;
	}, delay)
	typeof func === "function" && func();
};